package com.freedom.supercoin.network;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.POST;
import rx.Observable;

/**
 * Created by zzq on 2018/4/3.
 */

public class ApiService {
    private NetService netService;



    public interface NetService {
        @POST("klineList")
        Observable<Result<String>>getklineList();
    }



    public ApiService(String baseUrl) {
        this.netService = newNetService(baseUrl);
    }



    public NetService getNetService() {
        return netService;
    }




    private NetService newNetService(String baseUrl) {
        return new Retrofit.Builder()
                .baseUrl(baseUrl)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .client(HttpClientFactory.getInstance().getHttpClient())
                .build()
                .create(NetService.class);
    }
}
